#include "Core/Profile/CodeProfile.h"
#include "ThreadTest.h"

const char * ThreadTest::GetName() const
{
	return "[CORE] Thread Test";
}

Core::error ThreadTest::Create()
{
	if(Failed(UnitTest::Create()))
		return Core::errFailed;

	return Core::errOK;
}

Core::error ThreadTest::Destroy()
{
	if(Failed(UnitTest::Destroy()))
		return Core::errFailed;

	return Core::errOK;
}

Core::error ThreadTest::Execute()
{
	PROFILE(GetName());

	const int32 size = 10;
	std::vector<A*> array;
	for (uint32 i = 0; i<size; ++i)
	{
		array.push_back(new A);
		array[i]->Start();
	}

	for (uint32 i = 0; i<size; ++i)
	{
		array[i]->Synchronize();
	}

	for (uint32 i = 0; i<size; ++i)
	{
		delete array[i];
	}

	return Core::errOK;
}
